package com.googlecode.bipol.war.services;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

import com.googlecode.bip.entity.IQuestion;

public interface QuestionManager extends Serializable {
    /**
    * Create a new question for a topic
    * The question will be created with the idLocal of the topic
    *
    * @param topicId The id of the topic the question should be added
    * @param name The name of the question
    * @param idLocal Code id for localization
    * @param description The description of the question
    * @param minValue The minimum value the answer can take
    * @param maxValue The maximum value the answer can take
    * @param defaultValue The default value of the answer
    * @return
    * @throws ServiceException
    */
    public IQuestion createQuestion(
            int topicId,
            String name, String description, String idLocal,
            int minValue, int maxValue, int defaultValue) throws ServiceException;
    
    /**
     * Create or update a question
     * The parentIdTopic must exists
     * If the idQuestion is set to 0, a new question will be created
     * Otherwise, the question with idQuestion will be updated, if it exists
     * @param question The question model
     * @return The created/updated question
     * @throws ServiceException If topic parent does not exists, if the question does not exist (assuming it's id is different than zero) 
     */
    public IQuestion postQuestion(IQuestion question) throws ServiceException;

    /**
    * Remove an existing question
    *
    * @param idquestion The id of the question
    * @param idlocal Code id for localization
    * @return IQuestion The removed question
    */
    public IQuestion removeQuestion(int idquestion, String idlocal) throws ServiceException;

    /**
    * Get all the existing questions attached to the specified topic
    *
    * @param idtopic The id of the topic
    * @param idlocal Code id for localization
    * @return The list of questions
    * @throws ServiceException
    */
    public List<IQuestion> getQuestionsOfTopic(int idtopic, String idlocal) throws ServiceException;
    
    /**
     * Get all the text  description of the question's value
     * @param idquestion The id of the question
     * @param idlocal Code id for localization
     * @return A map (value/text)
     * @throws ServiceException
     */
    @Deprecated
    public Map<Integer,String> fetchQuestionTextValues(int idquestion, String idlocal) throws ServiceException;
    

}
